package it.csi.finregio.finreges.junit;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import oracle.jdbc.driver.OracleConnection;
import oracle.jdbc.driver.OracleDriver;

import it.crp.dao.DBConnection;
import it.crp.dao.DbException;

public class JUnitDbConnection implements DBConnection{
	
	

	public Connection getConnection(String dbKeyName) throws DbException {
		String driver = OracleDriver.class.getName();
		String url = "jdbc:oracle:thin:@svil92.csi.it:1540:SVIL92";
		String user = "finregio";
		String pwd = "finregio_01";
		Connection con = null;
		try {
			Class.forName(driver);
			con = DriverManager.getConnection(url,user,pwd);
//			System.out.println("Connessione ottenuta: "+((OracleConnection)con).getUserName());
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return con;
	}

}
